package com.chimm.redpacket.demo_single;

import com.chimm.redpacket.bean.RedPacket;

import java.math.BigDecimal;
import java.util.List;

/**
 * 抢红包设计方式二
 *
 * @author Chimm Huang
 */
public class Demo02 {

    public static void main(String[] args) {
        RedPacket redPacket = new RedPacket(BigDecimal.valueOf(100), 5);
        List<BigDecimal> redPackets = redPacket.splitRedPacket();
        System.err.printf("================ 红包来啦，金额：%s 元，数量：%s 个 ================%n", redPacket.getAmount(), redPacket.getNum());

        for (BigDecimal red : redPackets) {
            System.out.println("你抢到了：" + red + "元");
        }
    }
}
